package com.eclink.asset.asset.convert;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.eclink.asset.asset.domain.dao.FlowApply;
import com.eclink.asset.domain.dto.FlowApplyDetailDTO;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class FlowApplyConvert {

    public FlowApplyDetailDTO dao2detail(FlowApply source) {
        FlowApplyDetailDTO dto = new FlowApplyDetailDTO();
        BeanUtil.copyProperties(source, dto, "formData");
        if (source.getFormData() != null) {
            dto.setFormData(JSON.parseObject(source.getFormData(), Map.class));
        }
        return dto;
    }

}
